package com.alliky.home.ui.viewmodel;

import android.graphics.drawable.Drawable;

import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import androidx.databinding.ObservableField;

import com.alliky.core.entity.vo.CategoryVO;
import com.alliky.core.base.ItemViewModel;
import com.alliky.home.R;

/**
 * ================================================
 *
 * @Description: 描述
 * @Author: wxianing
 * @Date: 2022/6/13 11:46
 * ================================================
 */
public class HomeCategoryItemViewModel extends ItemViewModel<HomeViewModel> {

    public ObservableField<CategoryVO> category = new ObservableField<>();
    public Drawable drawableImg;

    public HomeCategoryItemViewModel(@NonNull HomeViewModel homeViewModel, CategoryVO categoryVO) {
        super(homeViewModel);

        category.set(categoryVO);
        //ImageView的占位图片，可以解决RecyclerView中图片错误问题
        drawableImg = ContextCompat.getDrawable(viewModel.getApplication(), R.mipmap.icon_default);
    }

}
